#pragma once
#ifndef __SCONF_H__
#define __SCONF_H__
// simple config

enum {
    SCONF_TYPE_INT,
    SCONF_TYPE_MAC,
    SCONF_TYPE_STR,

    SCONF_TYPE_CNT
};

#define SCONF_MAX_STR_LEN 1000

typedef struct {
    const char* key;
    void* addr;
    int type;
    int size;
} sconf_pat_stru;

#define SCONF_PAT(_key, _type, _cfg, _member) \
    {.key = _key, .type = _type,\
        .size = sizeof((_cfg)._member), \
        .addr = (void *)&((_cfg)._member)}

int sconf_parse(const char* conf, const sconf_pat_stru* table, int cnt);
#endif
